#include <iostream>
#include <string>


//this : c++编译器提供给类的指向本对象的指针
//  this-> 取当前对象的属性和行为
//  *this : 当前对象
class Student
{
public:
    Student()  //无参构造函数
    {
        std::cout<<"无参构造函数！\n";
        printf("this : %p\n", this);
    }

    Student(int id, const char* name) //带参构造
    {
        std::cout<<"带参构造函数"<<std::endl;
        this->id = id;
        this->name = name;
    }

    Student& GetObj()
    {
        return *this; //取当前对象
    }
private:
    int id;
    std::string name;
};


int main()
{
    Student s;
    printf("s : %p\n", &s);
    return 0;
}